package com.dwxt.sport.controller;

import com.dwxt.common.base.BaseResult;
import com.dwxt.sport.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class FileController {

    @Autowired
    private FileService fileService;

    @RequestMapping("/cms/file/saveFileLocal")
    public BaseResult saveFileLocal(MultipartFile file) throws IOException {
        String fileUrl = fileService.saveFile(file, null);
        return BaseResult.ok(fileUrl);
    }
}
